// 导入RSA加密方法
import JSEncrypt from 'jsencrypt';
import { userStore } from '@/store/index';
/**
 * @description: RSA加密方法
 * @param {*} publicKey RSA公钥
 * @param {*} data 要加密的数据
 * @return {*} 密文信息
 */
export async function encryptFun(publicKey, data) {
    let encrypt = new JSEncrypt();
    encrypt.setPublicKey(publicKey);
    return encrypt.encrypt(data);
}

/**
 * @description: 获取用户Token
 * @return {*}
 */
export let getAuthorToken = () => {
    let token = userStore.userToken.token;
    return token;
};

/**
 * @description: 获取RefreshToken
 * @return {*}
 */
export let getRefreshToken = () => {
    let refreshtoken = userStore.userToken.refreshtoken;
    console.log('开始获取reToken', refreshtoken);
    return refreshtoken;
};

// export let refreshtokenFun = async () => {
//     //获取本地长token
// };